﻿using Learun.Util;
using SqlSugar;
using System;
namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
    /// <summary>
    /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
    /// Copyright (c) 2013-2018 Hexagon PPM
    /// 创 建：超级管理员
    /// 日 期：2022-02-23 11:30
    /// 描 述：属性表
    /// </summary>
    [SugarTable(TableName = "ec_property")]
    public class ec_propertyEntity
    {
        #region 实体成员 
        /// <summary> 
        /// 属性ID 
        /// </summary> 
        [SugarColumn(IsPrimaryKey = true)]
        public string PropertyID { get; set; }
        /// <summary> 
        /// 属性组 ，<see cref="ec_propertygEntity.PropertyGID"/>
        /// </summary> 
        public string PropertyGID { get; set; } = "";
        /// <summary>
        /// 常用属性 或 不常用属性。数据库对应类型为int0
        /// </summary>
        /// <returns></returns> 
        public int? BasicGroup { get; set; } = 1;
        /// <summary> 
        /// 计量单位分类ID ，<see cref="ec_measuring_unittypeEntity.MeasuringUnitTypeID"/>
        /// </summary> 
        public string MeasuringUnitTypeID { get; set; } = "";
        /// <summary> 
        /// 属性名称 
        /// </summary> 
        public string PropertyName { get; set; } = "";
        /// <summary> 
        /// 属性名称(英文)
        /// </summary> 
        public string PropertyNameEN { get; set; } = "";
        /// <summary> 
        /// 属性类型 
        /// </summary> 
        public string PropertyType { get; set; } = "";
        /// <summary> 
        /// 小数点 
        /// </summary> 
        [NullValue]
        public int? DecimalPoint { get; set; }
        /// <summary> 
        /// 枚举数据 
        /// </summary> 
        [NullValue]
        public string EnumData { get; set; } = "";
        /// <summary> 
        /// 是否必填 
        /// </summary> 
        public int? IsRequired { get; set; }
        /// <summary> 
        /// 默认计量单位 
        /// </summary> 
        public string DefaultUnit { get; set; } = "";
        /// <summary> 
        /// 排序 
        /// </summary> 
        public int? OrderID { get; set; }
        /// <summary> 
        /// 默认值 
        /// </summary> 
        public string DefaultValue { get; set; } = "";
        /// <summary>
        /// 字典明细ID
        /// </summary>
        public string DataItemDetailID { get; set; } = "";

        /// <summary> 
        /// 创建人 
        /// </summary> 
        public string CreateUserID { get; set; }
        /// <summary> 
        /// 创建时间 
        /// </summary> 
        public DateTime? CreateTime { get; set; }
        /// <summary> 
        /// 更新人 
        /// </summary> 
        public string UpdateUserID { get; set; }
        /// <summary> 
        /// 更新时间 
        /// </summary> 
        public DateTime? UpdateTime { get; set; }
        #endregion

        #region 扩展操作
        /// <summary>
        /// 新增调用
        /// </summary>
        public void Create()
        {
            this.PropertyID = Guid.NewGuid().ToString();
            this.CreateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.CreateUserID = userInfo.userId;
        }
        /// <summary>
        /// 编辑调用
        /// </summary>
        /// <param name="keyValue"></param>
        public void Modify(string keyValue)
        {
            this.PropertyID = keyValue;
            this.UpdateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.UpdateUserID = userInfo.userId;
        }
        #endregion
        #region 扩展字段
        /// <summary>
        /// 属性值
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsIgnore = true)]
        public string PropertyValue { get; set; }
        /// <summary>
        /// 属性类型名称
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsIgnore = true)]
        public string PropertyTypeName { get; set; }
        /// <summary>
        /// 枚举数据分类名称
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsIgnore = true)]
        public string EnumDataName { get; set; }
        /// <summary> 
        /// 工程数据属性创建人 
        /// </summary> 
        [SugarColumn(IsIgnore = true)]
        public string EngineCreateUserName { get; set; }
        /// <summary> 
        /// 工程数据属性创建时间 
        /// </summary> 
        [SugarColumn(IsIgnore = true)]
        public DateTime? EngineCreateTime { get; set; }
        /// <summary> 
        /// 工程数据属性更新人 
        /// </summary> 
        [SugarColumn(IsIgnore = true)]
        public string EngineUpdateUserName { get; set; }
        /// <summary> 
        /// 工程数据属性更新时间 
        /// </summary> 
        [SugarColumn(IsIgnore = true)]
        public DateTime? EngineUpdateTime { get; set; }
        /// <summary>
        /// 工程数据属性ID
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsIgnore = true)]
        public string EngineDataPropertyID { get; set; }
        /// <summary>
        /// 属性组名称
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsIgnore = true)]
        public string PropertyGroupName { get; set; }
        /// <summary> 
        /// 计量单位分类名称
        /// </summary> 
        [SugarColumn(IsIgnore = true)]
        public string MeasuringUnitTypeName { get; set; }
        /// <summary> 
        /// 默认计量单位名称
        /// </summary> 
        [SugarColumn(IsIgnore = true)]
        public string DefaultUnitName { get; set; }
        /// <summary> 
        /// 计量单位(工程数据属性)
        /// </summary> 
        [SugarColumn(IsIgnore = true)]
        public string MeasuringUnitName { get; set; }
        [SugarColumn(IsIgnore = true)]
        public string DefaultValueEnum { get; set; }
        #endregion
    }
}

